package br.ufrj.pesc.misc;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class CalendarioUtils {
	
	public static Calendar getCalendario(){		
		Calendar calendar = GregorianCalendar.getInstance();
		calendar.add(Calendar.HOUR_OF_DAY, -calendar.getTime().getHours());
		calendar.add(Calendar.MINUTE, -calendar.getTime().getMinutes());
		calendar.add(Calendar.SECOND, -calendar.getTime().getSeconds());
		calendar.set(Calendar.MILLISECOND, 0);
		calendar.add(Calendar.DAY_OF_MONTH, 1);
		return calendar;		
	}
	
	public static Calendar getCalendarioDiasAtrasado(int numDias){		
		Calendar calendar = getCalendario();
		calendar.add(Calendar.DAY_OF_MONTH, -Math.abs(numDias));			
		return calendar;
	}
	
	public static Calendar getCalendarioMesAtrasado(int numSemanas){		
		Calendar calendar = getCalendario();
		calendar.add(Calendar.MONTH, -Math.abs(numSemanas));		
		return calendar;
	}
	
	public static Calendar getCalendarioAnoAtrasado(int numSemanas){		
		Calendar calendar = getCalendario();
		calendar.add(Calendar.YEAR, -Math.abs(numSemanas));		
		return calendar;
	}

}
